Ext.namespace('pages.p2p.hPlan.planselect');

pages.p2p.hPlan.planselect.View = function(config) {
	Ext.apply(this, config);
	/** 操作类型 */
	this.operType = config.operType;
	this.record = config.record;
	this.initUIComponents();
	pages.p2p.hPlan.planselect.View.superclass.constructor.call(this);
};
Ext.extend(pages.p2p.hPlan.planselect.View, Ext.Window, {
	initUIComponents : function() {
		this.form = new Ext.form.FormPanel({
			region : 'center',
			layout : 'column',
			title:'项目信息',
			height : 300,
			labelWidth : 125,
			labelAlign : 'left',
			autoScroll : true,
			border : false,
			frame : false,
			bodyStyle : 'padding:5', 
			items : [ {
				columnWidth : 1,
				height : 10,
				border : false
			},{
				columnWidth : .5,
				layout : 'form',
				border : false,
				items : [ {
                    fieldLabel : '项目名称',
                    xtype : 'textfield',
                    name : 'V_H_PLAN_XM_NAME',
                    id : 'V_H_PLAN_XM_NAME',
                    readOnly : true,
                    anchor : '99%'
                } ]
			},{
                columnWidth : .5,
                layout : 'form',
                border : false,
                items : [ {
                    fieldLabel : '年化收益率(%)',
                    xtype : 'textfield',
                    name : 'V_H_PLAN_NH_SYL',
                    id : 'V_H_PLAN_NH_SYL',
                    readOnly : true,
                    anchor : '98%'
                } ]
            }, {
				columnWidth : .5,
				layout : 'form',
				border : false,
				items : [ {
					fieldLabel : '期限(月)',
					xtype : 'textfield',
					name : 'V_H_PLAN_QX_MONTH',
					id : 'V_H_PLAN_QX_MONTH',
					readOnly : true,
					anchor : '98%'
				} ]
			}, {
                columnWidth : .5,
                layout : 'form',
                border : false,
                items : [ {
                    fieldLabel : '项目金额',
                    xtype : 'textfield',
                    name : 'V_H_PLAN_XM_JE',
                    id : 'V_H_PLAN_XM_JE',
                    readOnly : true,
                    anchor : '98%'
                } ]
            }, {
				columnWidth : .5,
				layout : 'form',
				border : false,
				items : [ {
					fieldLabel : '项目进度',
					xtype : 'textfield',
					name : 'V_H_PLAN_XM_JD',
					id : 'V_H_PLAN_XM_JD',
					readOnly : true,
					anchor : '98%'
				} ]
			},{
                columnWidth : .5,
                layout : 'form',
                border : false,
                items : [ {
                    fieldLabel : '项目状态',
                    xtype : 'textfield',
                    name : 'V_H_PLAN_XM_ZT',
                    id : 'V_H_PLAN_XM_ZT',
                    readOnly : true,
                    anchor : '98%'
                } ]
            }, {
				columnWidth : 1,
				layout : 'form',
				border : false,
				items : [{
					fieldLabel : '计划介绍',
					xtype : 'textarea',
					name : 'V_H_PLAN_XM_JHJS',
					id : 'V_H_PLAN_XM_JHJS',
					readOnly : true,
					anchor : '99%'
				}]
			}, {
                columnWidth : 1,
                layout : 'form',
                border : false,
                items : [ {
                    fieldLabel : '投标范围',
                    xtype : 'textarea',
                    name : 'V_H_PLAN_TBFW',
                    id : 'V_H_PLAN_TBFW',
                    readOnly : true,
                    anchor : '99%'
                } ]
            },{
				columnWidth : .5,
				layout : 'form',
				border : false,
				items : [ {
					fieldLabel : '发标日期',
					xtype : 'textfield',
					name : 'V_H_PLAN_FB_DATE',
					id : 'V_H_PLAN_FB_DATE',
					readOnly : true,
					anchor : '98%'
				} ]
			}, {
                columnWidth : .5,
                layout : 'form',
                border : false,
                items : [ {
                    fieldLabel : '项目募集期',
                    xtype : 'textfield',
                    name : 'V_H_PLAN_XM_MJQ',
                    id : 'V_H_PLAN_XM_MJQ',
                    readOnly : true,
                    anchor : '98%'
                } ]
            }, {
                columnWidth : .5,
                layout : 'form',
                border : false,
                items : [ {
                    fieldLabel : '截标日期',
                    xtype : 'textfield',
                    name : 'V_H_PLAN_JB_DATE',
                    id : 'V_H_PLAN_JB_DATE',
                    readOnly : true,
                    anchor : '98%'
                } ]
            }, {
                columnWidth : .5,
                layout : 'form',
                border : false,
                items : [ {
                    fieldLabel : '计息日期',
                    xtype : 'textfield',
                    name : 'V_H_PLAN_JX_DATE',
                    id : 'V_H_PLAN_JX_DATE',
                    readOnly : true,
                    anchor : '98%'
                } ]
            }, {
                columnWidth : .5,
                layout : 'form',
                border : false,
                items : [ {
                    fieldLabel : '到期日期',
                    xtype : 'textfield',
                    name : 'V_H_PLAN_DQ_DATE',
                    id : 'V_H_PLAN_DQ_DATE',
                    readOnly : true,
                    anchor : '98%'
                } ]
            }, {
                columnWidth : .5,
                layout : 'form',
                border : false,
                items : [ {
                    fieldLabel : '还款类型',
                    xtype : 'textfield',
                    name : 'V_HK_TYPE',
                    id : 'V_HK_TYPE',
                    readOnly : true,
                    anchor : '98%'
                } ]
            }, {
                columnWidth : .5,
                layout : 'form',
                border : false,
                items : [ {
                    fieldLabel : '还款状态',
                    xtype : 'textfield',
                    name : 'V_HK_STATUS',
                    id : 'V_HK_STATUS',
                    readOnly : true,
                    anchor : '98%'
                } ]
            }, {
                columnWidth : .5,
                layout : 'form',
                border : false,
                items : [ {
                    fieldLabel : '当前已还款期数',
                    xtype : 'textfield',
                    name : 'V_HK_QS',
                    id : 'V_HK_QS',
                    readOnly : true,
                    anchor : '98%'
                } ]
            }]
		});
		Ext.apply(this, {
			id : 'form_zqff_view',
			title : '查看详情',
			border : false,
			layout : 'border',
			enableTabScroll: true, 
			style:{
				marginRight: 'auto',
		        marginLeft: 'auto'
			},
			width : 700,
			height : 440,
			modal : true,
			items : [ this.form ],
			listeners:{
				'render' : this.initData.createDelegate(this)
			},
			tbar : [ {
				text : '关闭',
				iconCls : 'close',
				handler: function(){
					this.close();
				}.createDelegate(this)
			} ]
		});
	},
	initData : function() {
		Ext.getCmp('V_H_PLAN_XM_NAME').setValue(this.record.get("H_PLAN_XM_NAME"));
		Ext.getCmp('V_H_PLAN_NH_SYL').setValue(this.record.get("H_PLAN_NH_SYL"));
		Ext.getCmp('V_H_PLAN_QX_MONTH').setValue(this.record.get("H_PLAN_QX_MONTH"));
		Ext.getCmp('V_H_PLAN_XM_JE').setValue(this.record.get("H_PLAN_XM_JE"));
		Ext.getCmp('V_H_PLAN_XM_JD').setValue(this.record.get("H_PLAN_XM_JD"));
		var zt = this.record.get("H_PLAN_XM_ZT");
		if(zt=='1'){
			zt = "待审核";
		}else if(zt=='2'){
			zt = "审核通过";
		}else if(zt=='3'){
			zt = "审核失败";
		}else if(zt=='4'){
			zt = "招标中";
		}else if(zt=='5'){
			zt = "已截标";
		}else if(zt=='6'){
			zt = "投标完成";
		}else if(zt=='7'){
			zt = "还款成功";
		}
		Ext.getCmp('V_H_PLAN_XM_ZT').setValue(zt);
		Ext.getCmp('V_H_PLAN_XM_JHJS').setValue(this.record.get("H_PLAN_XM_JHJS"));
		Ext.getCmp('V_H_PLAN_TBFW').setValue(this.record.get("H_PLAN_TBFW"));
		Ext.getCmp('V_H_PLAN_FB_DATE').setValue(this.record.get("H_PLAN_FB_DATE"));
		Ext.getCmp('V_H_PLAN_XM_MJQ').setValue(this.record.get("H_PLAN_XM_MJQ"));
		Ext.getCmp('V_H_PLAN_JB_DATE').setValue(this.record.get("H_PLAN_JB_DATE"));
		Ext.getCmp('V_H_PLAN_JX_DATE').setValue(this.record.get("H_PLAN_JX_DATE"));
		Ext.getCmp('V_H_PLAN_DQ_DATE').setValue(this.record.get("H_PLAN_DQ_DATE"));
		var hktype = this.record.get("HK_TYPE");
		if(hktype=='01'){
			hktype = "按月付息，到期还本";
		}else if(hktype=='02'){
			hktype = "一次性到期还本付息";
		}
		Ext.getCmp('V_HK_TYPE').setValue(hktype);
		var hkstate = this.record.get("HK_STATUS");
		if(hkstate =='01'){
			hkstate = "未还款";
		}else if(hkstate =='02'){
			hkstate = "正在还款";
		}else if(hkstate =='03'){
			hkstate = "还款结束";
		}
		Ext.getCmp('V_HK_STATUS').setValue(hkstate);
		Ext.getCmp('V_HK_QS').setValue(this.record.get("HK_QS"));
	}
});